<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<include file="public:meta" />
		<link href="../public/css/company/common.css" rel="stylesheet" type="text/css" />
		<link href="../public/css/company/company_jobs.css" rel="stylesheet" type="text/css" />
		<link href="../public/css/company/company_ajax_dialog.css" rel="stylesheet" type="text/css" />
		<script src="../public/js/company/jquery.common.js" type="text/javascript" language="javascript"></script>
	</head>
	<body>
		<include file="index_header" />
		<div class="user_main">
			<div class="mleft">
				<include file="left_jobs" />
			</div>
			<div class="mright">
				<div class="user_pagetitle">
					<div class="pat_l">管理职位</div>
					<div class="clear"></div>
				</div>
				<div class="user_tab mt15">
					<a href="{:U('company/jobs_list')}" class="tabli <if condition="$Think.get.type eq ''">select</if>">全部职位</a>
					<a href="{:U('company/jobs_list',array('type'=>1))}" class="tabli <if condition="$Think.get.type eq 1">select</if>">发布中的职位</a>
					<a href="{:U('company/jobs_list',array('type'=>2))}" class="tabli <if condition="$Think.get.type eq 2">select</if>">未显示的职位</a>
					<div class="clear"></div>
					<if condition="$upper_limit eq 1">
					<div class="btnbox"><div class="btn_yellow m_btn J_hoverbut btn_add J_addJobsDig" href="javascript:;">发布职位</div></div>
					<else />
					<div class="btnbox"><div class="btn_yellow m_btn J_hoverbut btn_add" onclick="window.location='{:U('jobs_add')}'">发布职位</div></div>
					</if>
				</div>
				
				<notempty name="jobs_list['list']">
				<form id="form1" action="{:U('jobs_perform')}" class="J_allListBox" method="post">
					<div class="jobsWrap">
						<volist name="jobs_list['list']" id="jobs">
							<if condition="$jobs['display'] eq 2 || $jobs['_audit'] neq 1">
								<div class="jobsList">
									<div class="selWrap">
										<input name="y_id[]" class="selStatus J_allList" type="checkbox" value="{$jobs['id']}">
									</div>
									<div class="jobs fl">
										<div class="title">
											<a target="_blank" href="{$jobs.jobs_url}" class="">{$jobs.jobs_name}</a>
											&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{$jobs.district_cn}
										</div>
										<div class="update">
											待处理简历：
											<a href="{:U('company/jobs_apply',array('jobs_id'=>$jobs['id'],'stop'=>1))}" class="">{$jobs.applys}</a>
											&nbsp;&nbsp; | &nbsp;&nbsp;更新时间：{:date('Y-m-d H:i',$jobs['refreshtime'])}
										</div>
									</div>
									<if condition="$jobs['_audit'] eq 2">
										<div class="status fl font_yellow">审核中</div>
									<elseif condition="$jobs['_audit'] eq 3" />
										<div class="status fl font_red">审核未通过</div>
									<else />
										<div class="status fl font_red">已关闭</div>
									</if>
									<div class="edit link_blue fl">
										<a href="{:U('company/jobs_edit',array('id'=>$jobs['id']))}" class="">修改</a>
										<if condition="$jobs['_audit'] eq 1 && $jobs['display'] eq 2">
										<a href="javascript:;" url="{:U('jobs_display',array('y_id'=>$jobs['id'],'list_type'=>$_GET['type']))}" class="jobs_display">恢复</a>
										</if>
										<a href="javascript:;" url="{:U('jobs_delete',array('y_id'=>$jobs['id'],'list_type'=>$_GET['type']))}" class="delete">删除</a>
									</div>
									<div class="clear"></div>
								</div>
							<else/>
								<div class="jobsList">
									<div class="selWrap">
										<input name="y_id[]" class="selStatus J_allList" type="checkbox" value="{$jobs['id']}">
									</div>
									<div class="jobs fl">
										<div class="title">
											<a target="_blank" href="{$jobs.jobs_url}" class="">{$jobs.jobs_name}</a>
											&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{$jobs.district_cn}
										</div>
										<div class="update">
											待处理简历：
											<a href="{:U('company/jobs_apply',array('jobs_id'=>$jobs['id']))}" class="">{$jobs.applys}</a>
											&nbsp;&nbsp; | &nbsp;&nbsp;更新时间：{:date('Y-m-d H:i',$jobs['refreshtime'])}
										</div>
										<div class="J_operation btns">
											<a href="{:U('jobs_edit',array('id'=>$jobs['id']))}">修改</a>
											
											<a href="javascript:;" url="{:U('jobs_close',array('y_id'=>$jobs['id'],'list_type'=>$_GET['type']))}" class="close">关闭</a>
											<a href="javascript:;" url="{:U('jobs_delete',array('y_id'=>$jobs['id'],'list_type'=>$_GET['type']))}" class="delete">删除</a>
											<a href="javascript:;" class="friend" url="{:urlencode(build_web_url(array('c'=>'jobs','a'=>'jobs_show','params'=>'id='.$jobs["id"])))}">分享到朋友圈</a>
										</div>
									</div>
									<div class="aloneOperation fl">
									</div>
									<div class="clear"></div>
								</div>
							</if>
						</volist>
					</div>
					<div class="jobsWrap">
						<div class="allSelWrap">
							<input name="" class="allSel J_allSelected" type="checkbox">
						</div>
						<div class="btn_lightgray J_hoverbut btn_inline btn_border" id="delete_all">删除职位</div>
						<div class="qspage">{$jobs_list.page}</div>
						<div class="clear"></div>
					</div>
				</form>
				<else/>
					<div class="jobsWrap">
						<div class="res_empty">
							亲爱的HR，您还没有发布职位<br>
							想要快速找到合适的人才，就赶紧发布职位招揽人才吧~
						</div>
						<div class="res_empty_addbox">
							<div class="btn_blue m_btn J_hoverbut btn_115_38" onclick="window.location='{:U('jobs_add')}'">发布职位>></div>
						</div>
					</div>
				</notempty>
			</div>
			<div class="clear"></div>
		</div>
		<include file="index_footer" />
		<script type="text/javascript" src="../public/js/jquery.allselected.js"></script>
		<script type="text/javascript">
			$(document).ready(function(){
				$("#delete_all").click(function(){
					var listCheckedArray = $('.J_allListBox .J_allList:checked');
					if (!listCheckedArray.length) {
						disapperTooltip("remind",'请选择职位');
						return false;
					}
					var url = "{:U('jobs_delete')}";
		            var qsDialog = $(this).dialog({
		                title: '删除职位',
		                loading: true,
		                border: false,
		                yes: function () {
		                    $("#form1").attr('action',"{:U('jobs_delete')}");
							$("#form1").submit();
		                }
		            });
		            $.getJSON(url, function (result) {
		                if (result.status == 1) {
		                    qsDialog.setContent(result.data.html);
		                } else {
		                    disapperTooltip('remind', result.msg);
		                }
		            });
				});
				$(".close").click(function(){
					var url = $(this).attr('url');
		            var qsDialog = $(this).dialog({
		                title: '关闭职位',
		                loading: true,
		                border: false,
		                yes: function () {
		                    $.post(url, function (result) {
				                if (result.status == 1) {
				                	disapperTooltip("success",result.msg);
				                	setTimeout(function () {
				                        location.href=result.data;
				                    }, 2000);
				                } else {
				                    disapperTooltip('remind', result.msg);
				                }
				            },'json');
		                }
		            });
		            $.getJSON(url, function (result) {
		                if (result.status == 1) {
		                    qsDialog.setContent(result.data.html);
		                } else {
		                    disapperTooltip('remind', result.msg);
		                }
		            });
				});
				$(".delete").click(function(){
					var url = $(this).attr('url');
		            var qsDialog = $(this).dialog({
		                title: '删除职位',
		                loading: true,
		                border: false,
		                yes: function () {
		                    $.post(url, function (result) {
				                if (result.status == 1) {
				                	disapperTooltip("success",result.msg);
				                    setTimeout(function () {
				                        location.href=result.data;
				                    }, 2000);
				                } else {
				                    disapperTooltip('remind', result.msg);
				                }
				            },'json');
		                }
		            });
		            $.getJSON(url, function (result) {
		                if (result.status == 1) {
		                    qsDialog.setContent(result.data.html);
		                } else {
		                    disapperTooltip('remind', result.msg);
		                }
		            });
				});
				// 分享到朋友圈
				$(".friend").click(function(){
					var qsDialog = $(this).dialog({
		        		loading: true,
						footer: false,
						header: false,
						border: false,
						backdrop: false
					});
					var url = $(this).attr('url');
					qsDialog.hide();
					var qsDialogSon = $(this).dialog({
		        		title: '分享到朋友圈',
		        		content: '<img width="200" height="200" src="{:C("qscms_site_dir")}index.php?m=Home&c=Qrcode&a=index&url='+url+'" />',
						footer: false
					});
				});
				$(".jobs_refresh").click(function(){
					var url = $(this).attr('url');
					var footerShow = eval($(this).data('type'));
					var qsDialog = $(this).dialog({
		        		title: '职位刷新',
		        		loading:true,
						showFooter: false,
						yes:function(){
							$.post(url,function(result){
								if(result.status){
									disapperTooltip("success",result.msg);
                					setTimeout(function () {
				                        window.location.reload();
				                    }, 2000);
								}else{
					                disapperTooltip("remind",result.msg);
					                return false;
					            }
							},'json');
						}
					});
					$.getJSON(url,function(result){
						if(result.data.show_footer==0){
							qsDialog.showFooter(false);
						}else{
							if (!footerShow) {
								qsDialog.showFooter(true);
							}
						}
						qsDialog.setContent(result.msg);
					});
				});
				$(".stick_btn").click(function(){
					var qsDialog = $(this).dialog({
		        		title: '职位置顶',
		        		loading:true,
						showFooter: false
					});
					var url = "{:U('CompanyService/jobs_stick')}";
					var jobs_id = $(this).attr('data');
					$.getJSON(url,{jobs_id:jobs_id},function(result){
						qsDialog.setContent(result.msg);
					});
				});
				$(".emergency_btn").click(function(){
					var qsDialog = $(this).dialog({
		        		title: '职位紧急',
		        		loading:true,
						showFooter: false
					});
					var url = "{:U('CompanyService/jobs_emergency')}";
					var jobs_id = $(this).attr('data');
					$.getJSON(url,{jobs_id:jobs_id},function(result){
						qsDialog.setContent(result.msg);
					});
				});
				$(".jobs_display").click(function(){
					var url = $(this).attr('url');
		            var qsDialog = $(this).dialog({
		                title: '恢复职位',
		                loading: true,
		                border: false,
		                yes: function () {
		                    $.post(url, function (result) {
				                if (result.status == 1) {
				                	disapperTooltip("success",result.msg);
				                    setTimeout(function () {
				                        location.href=result.data;
				                    }, 2000);
				                } else {
				                    disapperTooltip('remind', result.msg);
				                }
				            },'json');
		                }
		            });
		            $.getJSON(url, function (result) {
		                if (result.status == 1) {
		                    qsDialog.setContent(result.data.html);
		                } else {
		                    disapperTooltip('remind', result.msg);
		                }
		            });
				});
			});
		</script>
	</body>
</html>